<template>
	<view class="parent-view">
		<view class="ed-name-view">
			<text class="ed-name">请输入姓名</text>
			<input class="ed-name-input"  @input="nameInput"/>
		</view>
		
		<view class="ed-fukuan-view">
			<text class="ed-fukuan-txt">付款金额</text>
			<view class="ed-price-view">
				<text class="ed-price-txt">￥</text>
				<input class="ed-price-input" placeholder="请输入金额" type="digit"  @input="priceInput"/>
			</view>
			<view class="ed-price-line"></view>
			<view class="ed-beizhu-view">
				<text class="ed-beizhu-txt">备注：</text>
				<input class="ed-beizhu-input" placeholder="请输入金额来源" type="text" @input="beizhuInput" />
			</view>
		</view>
		
		<text class="ed-sure-btn" @click="addGDBLog">完成录入</text>
		
	</view>
</template>

<script>
	import request from '../../pages/index/request.js';
	export default {
		data() {
			return {
				nameStr:"",
				beizhuStr:"",
				priceNumber:0,
			}
		},
		methods: {
			onLoad: function(options) {
				this.treeid = options.treeid
			},
			onShow: function() {
				this.share.url = '../../pages/tabBar/home/index?appInviteId=' + this.appUtil.getAppInviteId()
				this.share.shareType = 1
			},
			nameInput:function(event){
				this.nameStr = event.target.value
			},
			priceInput:function(event){
				this.priceNumber = event.target.value
			},
			beizhuInput:function(event){
				this.beizhuStr = event.target.value
			},
			addGDBLog: function() {
				if(!this.nameStr){
					uni.showToast({
						title:"请输入姓名"
					})
					return
				}
				if(!this.priceNumber||this.priceNumber==0){
					uni.showToast({
						title:"请输入金额"
					})
					return
				}
				var that = this
				request.post("api/common/AddGDBLog", {
					treeid:this.treeid,
					name:this.nameStr,
					price:this.priceNumber,
					bio:this.beizhuStr
				}).then(data => {
					uni.showToast({
						title:"录入成功"
					})
					uni.$emit("refrash-quality-list")
				})
			},
		}
	}
</script>

<style>
	@import "index.css";
</style>
